library(quantmod)
library(rugarch)
library(forecast)
library(readxl)
library(stats)
knitr::opts_chunk$set(fig.width=6, fig.height=4) 

Yokogawa Electric Corp (6841)

1. import data

yokogawa <- read_excel("ESG/day-to-day-return/yokogawa.xlsx")
par(mfrow=c(1,1)) 
plot(yokogawa$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~yokogawa$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

yokogawa_r=yokogawa$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(yokogawa_r, seasonal=FALSE) # auto arima(0,0,0)
fit
## Series: yokogawa_r 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 estimated as 6.632:  log likelihood=-7801.88
## AIC=15605.76   AICc=15605.76   BIC=15611.86
yokogawa_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model='std')
yokogawa_garch <- ugarchfit(spec=yokogawa_spec, data=yokogawa_r)

3. forecast

yokogawa_f <- ugarchforecast(yokogawa_garch, n.ahead=40)
yokogawa_return_f <- yokogawa_f@forecast$seriesFor
yokogawa_volatility_f <- yokogawa_f@forecast$sigmaFor
plot(yokogawa_return_f, type='l') 

plot(yokogawa_volatility_f, type='l') 

Tokyo Century Corp (8439)

1. import data

tokyo_century <- read_excel("ESG/day-to-day-return/tokyo_century.xlsx")
plot(tokyo_century$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ tokyo_century$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

tokyo_century_r= tokyo_century$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(tokyo_century_r, seasonal=FALSE) # auto arima(0,0,1)
fit
## Series: tokyo_century_r 
## ARIMA(0,0,1) with non-zero mean 
## 
## Coefficients:
##          ma1    mean
##       0.0324  0.0802
## s.e.  0.0176  0.0457
## 
## sigma^2 estimated as 6.481:  log likelihood=-7762.69
## AIC=15531.39   AICc=15531.4   BIC=15549.69
tokyo_century_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,1)), distribution.model='std')
tokyo_century_garch <- ugarchfit(spec= tokyo_century_spec, data= tokyo_century_r)

3. forecast

tokyo_century_f <- ugarchforecast(tokyo_century_garch, n.ahead=40)
tokyo_century_return_f <- tokyo_century_f@forecast$seriesFor
tokyo_century_volatility_f <- tokyo_century_f@forecast$sigmaFor
plot(tokyo_century_return_f, type='l') 

plot(tokyo_century_volatility_f, type='l') 

Tokio Marine Holdings Inc (8766)

1. import data

tokio_marine <- read_excel("ESG/day-to-day-return/tokio_marine.xlsx")
plot(tokio_marine$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ tokio_marine$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

tokio_marine_r= tokio_marine$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(tokio_marine_r, seasonal=FALSE) # auto arima(1,0,3)
fit
## Series: tokio_marine_r 
## ARIMA(1,0,3) with non-zero mean 
## 
## Coefficients:
##          ar1      ma1     ma2      ma3    mean
##       0.8375  -0.8413  0.0191  -0.0669  0.0382
## s.e.  0.0491   0.0518  0.0222   0.0185  0.0264
## 
## sigma^2 estimated as 4.924:  log likelihood=-7308.12
## AIC=14628.24   AICc=14628.27   BIC=14664.85
tokio_marine_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(1,3)), distribution.model='std')
tokio_marine_garch <- ugarchfit(spec= tokio_marine_spec, data= tokio_marine_r)

3. forecast

tokio_marine_f <- ugarchforecast(tokio_marine_garch, n.ahead=40)
tokio_marine_return_f <- tokio_marine_f@forecast$seriesFor
tokio_marine_volatility_f <- tokio_marine_f@forecast$sigmaFor
plot(tokio_marine_return_f, type='l') 

plot(tokio_marine_volatility_f, type='l') 

Takeda Pharmaceutical Co Ltd (4502)

1. import data

takeda <- read_excel("ESG/day-to-day-return/takeda.xlsx")
plot(takeda$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ takeda$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

takeda_r= takeda$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(takeda_r, seasonal=FALSE) # auto arima(1,0,3)
fit
## Series: takeda_r 
## ARIMA(0,0,2) with zero mean 
## 
## Coefficients:
##           ma1      ma2
##       -0.0157  -0.0646
## s.e.   0.0174   0.0175
## 
## sigma^2 estimated as 2.595:  log likelihood=-6253.33
## AIC=12512.67   AICc=12512.67   BIC=12530.97
takeda_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(1,3)), distribution.model='std')
takeda_garch <- ugarchfit(spec= takeda_spec, data= takeda_r)

3. forecast

takeda_f <- ugarchforecast(takeda_garch, n.ahead=40)
takeda_return_f <- takeda_f@forecast$seriesFor
takeda_volatility_f <- takeda_f@forecast$sigmaFor
plot(takeda_return_f, type='l') 

plot(takeda_volatility_f, type='l') 

Sony Corp (6758)

1. import data

sony <- read_excel("ESG/day-to-day-return/sony.xlsx")
plot(sony$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ sony$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

sony_r= sony$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(sony_r, seasonal=FALSE) # auto arima(1,0,0)
fit
## Series: sony_r 
## ARIMA(1,0,0) with zero mean 
## 
## Coefficients:
##          ar1
##       0.0883
## s.e.  0.0173
## 
## sigma^2 estimated as 5.154:  log likelihood=-7385.24
## AIC=14774.49   AICc=14774.49   BIC=14786.69
sony_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(1,0)), distribution.model='std')
sony_garch <- ugarchfit(spec= sony_spec, data= sony_r)

3. forecast

sony_f <- ugarchforecast(sony_garch, n.ahead=40)
sony_return_f <- sony_f@forecast$seriesFor
sony_volatility_f <- sony_f@forecast$sigmaFor
plot(sony_return_f, type='l') 

plot(sony_volatility_f, type='l') 

Shionogi & Co Ltd (4507)

1. import data

shionogi <- read_excel("ESG/day-to-day-return/shionogi.xlsx")
plot(shionogi $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ shionogi $Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

shionogi_r= shionogi$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(shionogi_r, seasonal=FALSE) # auto arima(0,0,2)
fit
## Series: shionogi_r 
## ARIMA(0,0,2) with non-zero mean 
## 
## Coefficients:
##           ma1      ma2    mean
##       -0.0262  -0.0438  0.0603
## s.e.   0.0174   0.0177  0.0323
## 
## sigma^2 estimated as 3.986:  log likelihood=-6960.38
## AIC=13928.76   AICc=13928.77   BIC=13953.17
shionogi_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,2)), distribution.model='std')
shionogi_garch <- ugarchfit(spec= shionogi_spec, data= shionogi_r)

3. forecast

shionogi_f <- ugarchforecast(shionogi_garch, n.ahead=40)
shionogi_return_f <- shionogi_f@forecast$seriesFor
shionogi_volatility_f <- shionogi_f@forecast$sigmaFor
plot(shionogi_return_f, type='l') 

plot(shionogi_volatility_f, type='l') 

Ricoh Co Ltd (7752)

1. import data

ricoh <- read_excel("ESG/day-to-day-return/ricoh.xlsx")
plot(ricoh$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ ricoh$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

ricoh_r= ricoh$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(ricoh_r, seasonal=FALSE) # auto arima(0,0,0)
fit
## Series: ricoh_r 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 estimated as 5.494:  log likelihood=-7491.25
## AIC=14984.5   AICc=14984.5   BIC=14990.6
ricoh_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model='std')
ricoh_garch <- ugarchfit(spec= ricoh_spec, data= ricoh_r)

3. forecast

ricoh_f <- ugarchforecast(ricoh_garch, n.ahead=40)
ricoh_return_f <- ricoh_f@forecast$seriesFor
ricoh_volatility_f <- ricoh_f@forecast$sigmaFor
plot(ricoh_return_f, type='l') 

plot(ricoh_volatility_f, type='l') 

Olympus Corp (7733)

1. import data

olympus <- read_excel("ESG/day-to-day-return/olympus.xlsx")
plot(olympus$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ olympus$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

olympus_r= olympus$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(olympus_r, seasonal=FALSE) # auto arima(3,0,0)
fit
## Series: olympus_r 
## ARIMA(3,0,0) with zero mean 
## 
## Coefficients:
##          ar1     ar2      ar3
##       0.0799  0.0309  -0.0789
## s.e.  0.0174  0.0174   0.0174
## 
## sigma^2 estimated as 8.48:  log likelihood=-8205.69
## AIC=16419.38   AICc=16419.39   BIC=16443.78
olympus_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(3,0)), distribution.model='std')
olympus_garch <- ugarchfit(spec= olympus_spec, data= olympus_r)

3. forecast

olympus_f <- ugarchforecast(olympus_garch, n.ahead=40)
olympus_return_f <- olympus_f@forecast$seriesFor
olympus_volatility_f <- olympus_f@forecast$sigmaFor
plot(olympus_return_f, type='l') 

plot(olympus_volatility_f, type='l') 

Nippon Telegraph & Telephone Corp (9432)

1. import data

nippon_tele <- read_excel("ESG/day-to-day-return/nippon_tele.xlsx")
plot(nippon_tele$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ nippon_tele$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

nippon_tele_r= nippon_tele$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(nippon_tele_r, seasonal=FALSE) # auto arima(1,0,2)
fit
## Series: nippon_tele_r 
## ARIMA(1,0,2) with non-zero mean 
## 
## Coefficients:
##          ar1      ma1     ma2    mean
##       0.9122  -1.0173  0.0725  0.0419
## s.e.  0.0447   0.0482  0.0208  0.0180
## 
## sigma^2 estimated as 2.688:  log likelihood=-6302.37
## AIC=12614.75   AICc=12614.76   BIC=12645.25
nippon_tele_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(1,2)), distribution.model='std')
nippon_tele_garch <- ugarchfit(spec= nippon_tele_spec, data= nippon_tele_r)

3. forecast

nippon_tele_f <- ugarchforecast(nippon_tele_garch, n.ahead=40)
nippon_tele_return_f <- nippon_tele_f@forecast$seriesFor
nippon_tele_volatility_f <- nippon_tele_f@forecast$sigmaFor
plot(nippon_tele_return_f, type='l') 

plot(nippon_tele_volatility_f, type='l')

NEC Corp (6701)

1. import data

nec <- read_excel("ESG/day-to-day-return/nec.xlsx")
plot(nec$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ nec$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

nec_r= nec $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(nec_r, seasonal=FALSE) # auto arima(0,0,0)
fit
## Series: nec_r 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 estimated as 5.368:  log likelihood=-7453.12
## AIC=14908.24   AICc=14908.24   BIC=14914.34
nec_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model='std')
nec_garch <- ugarchfit(spec= nec_spec, data= nec_r)

3. forecast

nec_f <- ugarchforecast(nec_garch, n.ahead=40)
nec_return_f <- nec_f@forecast$seriesFor
nec_volatility_f <- nec_f@forecast$sigmaFor
plot(nec_return_f, type='l') 

plot(nec_volatility_f, type='l') 

Murata Manufacturing Co Ltd (6981)

1. import data

murata <- read_excel("ESG/day-to-day-return/murata.xlsx")
plot(murata$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ murata$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

murata_r= murata $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(murata_r, seasonal=FALSE) # auto arima(1,0,2)
fit
## Series: murata_r 
## ARIMA(1,0,2) with non-zero mean 
## 
## Coefficients:
##          ar1      ma1      ma2    mean
##       0.5696  -0.5550  -0.0703  0.0612
## s.e.  0.1347   0.1347   0.0180  0.0354
## 
## sigma^2 estimated as 5.469:  log likelihood=-7481.76
## AIC=14973.52   AICc=14973.53   BIC=15004.02
murata_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(1,2)), distribution.model='std')
murata_garch <- ugarchfit(spec= murata_spec, data= murata_r)

3. forecast

murata_f <- ugarchforecast(murata_garch, n.ahead=40)
murata_return_f <- murata_f@forecast$seriesFor
murata_volatility_f <- murata_f@forecast$sigmaFor
plot(murata_return_f, type='l') 

plot(murata_volatility_f, type='l') 

MS&AD Insurance Group Holdings Inc (8725)

1. import data

msad <- read_excel("ESG/day-to-day-return/msad.xlsx")
plot(msad$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ msad$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

msad_r= msad $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(msad_r, seasonal=FALSE) # auto arima(1,0,1)
fit
## Series: msad_r 
## ARIMA(1,0,1) with zero mean 
## 
## Coefficients:
##          ar1      ma1
##       0.8444  -0.8771
## s.e.  0.1210   0.1095
## 
## sigma^2 estimated as 5.408:  log likelihood=-6771.76
## AIC=13549.51   AICc=13549.52   BIC=13567.53
msad_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(1,1)), distribution.model='std')
msad_garch <- ugarchfit(spec= msad_spec, data= msad_r)

3. forecast

msad_f <- ugarchforecast(msad_garch, n.ahead=40)
msad_return_f <- msad_f@forecast$seriesFor
msad_volatility_f <- msad_f@forecast$sigmaFor
plot(msad_return_f, type='l') 

plot(msad_volatility_f, type='l') 

Mitsubishi Electric Corp (6503)

1. import data

mitsubishi <- read_excel("ESG/day-to-day-return/mitsubishi.xlsx")
plot(mitsubishi$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ mitsubishi$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

mitsubishi_r= mitsubishi $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(mitsubishi_r, seasonal=FALSE) # auto arima(0,0,0)
fit
## Series: mitsubishi_r 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 estimated as 5.622:  log likelihood=-7529.22
## AIC=15060.44   AICc=15060.44   BIC=15066.54
mitsubishi_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model='std')
mitsubishi_garch <- ugarchfit(spec= mitsubishi_spec, data= mitsubishi_r)

3. forecast

mitsubishi_f <- ugarchforecast(mitsubishi_garch, n.ahead=40)
mitsubishi_return_f <- mitsubishi_f@forecast$seriesFor
mitsubishi_volatility_f <- mitsubishi_f@forecast$sigmaFor
plot(mitsubishi_return_f, type='l') 

plot(mitsubishi_volatility_f, type='l') 

Kurita Water Industries Ltd (6370)

1. import data

kurita_water <- read_excel("ESG/day-to-day-return/kurita_water.xlsx")
plot(kurita_water$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ kurita_water$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

kurita_water_r= kurita_water $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(kurita_water_r, seasonal=FALSE) # auto arima(4,0,4)
fit
## Series: kurita_water_r 
## ARIMA(4,0,4) with zero mean 
## 
## Coefficients:
## Warning in sqrt(diag(x$var.coef)): NaNs produced
##          ar1     ar2     ar3     ar4      ma1      ma2      ma3     ma4
##       0.2671  0.6037  0.4347  -0.792  -0.2695  -0.5816  -0.4807  0.7604
## s.e.     NaN  0.0331     NaN     NaN      NaN   0.0343      NaN     NaN
## 
## sigma^2 estimated as 4.376:  log likelihood=-7112.04
## AIC=14242.07   AICc=14242.13   BIC=14296.99
kurita_water_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(4,4)), distribution.model='std')
kurita_water_garch <- ugarchfit(spec= kurita_water_spec, data= kurita_water_r)
## Warning in arima(data, order = c(modelinc[2], 0, modelinc[3]), include.mean
## = modelinc[1], : possible convergence problem: optim gave code = 1

3. forecast

kurita_water_f <- ugarchforecast(kurita_water_garch, n.ahead=40)
kurita_water_return_f <- kurita_water_f@forecast$seriesFor
kurita_water_volatility_f <- kurita_water_f@forecast$sigmaFor
plot(kurita_water_return_f, type='l') 

plot(kurita_water_volatility_f, type='l')

Japan Aviation Electronics Industry Ltd (6807)

1. import data

japan_avi <- read_excel("ESG/day-to-day-return/japan_avi.xlsx")
plot(japan_avi$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ japan_avi$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

japan_avi_r= japan_avi $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(japan_avi_r, seasonal=FALSE) # auto arima(0,0,3)
fit
## Series: japan_avi_r 
## ARIMA(0,0,3) with zero mean 
## 
## Coefficients:
##          ma1      ma2      ma3
##       0.0367  -0.0239  -0.0469
## s.e.  0.0174   0.0174   0.0173
## 
## sigma^2 estimated as 7.875:  log likelihood=-8083.73
## AIC=16175.45   AICc=16175.46   BIC=16199.86
japan_avi_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,3)), distribution.model='std')
japan_avi_garch <- ugarchfit(spec= japan_avi_spec, data= japan_avi_r)

3. forecast

japan_avi_f <- ugarchforecast(japan_avi_garch, n.ahead=40)
japan_avi_return_f <- japan_avi_f@forecast$seriesFor
japan_avi_volatility_f <- japan_avi_f@forecast$sigmaFor
plot(japan_avi_return_f, type='l') 

plot(japan_avi_volatility_f, type='l') 

Ibiden Co Ltd (4062)

1. import data

ibiden <- read_excel("ESG/day-to-day-return/ibiden.xlsx")
plot(ibiden$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ ibiden$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

ibiden_r= ibiden $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(ibiden_r, seasonal=FALSE) # auto arima(2,0,1)
fit
## Series: ibiden_r 
## ARIMA(2,0,1) with zero mean 
## 
## Coefficients:
##          ar1      ar2      ma1
##       0.7343  -0.0494  -0.7192
## s.e.  0.1682   0.0187   0.1680
## 
## sigma^2 estimated as 7.696:  log likelihood=-8045.82
## AIC=16099.65   AICc=16099.66   BIC=16124.05
ibiden_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(2,0,1)), distribution.model='std')
ibiden_garch <- ugarchfit(spec= ibiden_spec, data= ibiden_r)

3. forecast

ibiden_f <- ugarchforecast(ibiden_garch, n.ahead=40)
ibiden_return_f <- ibiden_f@forecast$seriesFor
ibiden_volatility_f <- ibiden_f@forecast$sigmaFor
plot(ibiden_return_f, type='l') 

plot(ibiden_volatility_f, type='l') 

Hitachi Ltd (6501)

1. import data

hitachi <- read_excel("ESG/day-to-day-return/hitachi.xlsx")
plot(hitachi$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ hitachi$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

hitachi_r= hitachi $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(hitachi_r, seasonal=FALSE) # auto arima(0,0,0)
fit
## Series: hitachi_r 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 estimated as 4.913:  log likelihood=-7306.99
## AIC=14615.99   AICc=14615.99   BIC=14622.09
hitachi_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model='std')
hitachi_garch <- ugarchfit(spec= hitachi_spec, data= hitachi_r)

3. forecast

hitachi_f <- ugarchforecast(hitachi_garch, n.ahead=40)
hitachi_return_f <- hitachi_f@forecast$seriesFor
hitachi_volatility_f <- hitachi_f@forecast$sigmaFor
plot(hitachi_return_f, type='l') 

plot(hitachi_volatility_f, type='l') 

Fujitsu Ltd (6702)

1. import data

fujitsu <- read_excel("ESG/day-to-day-return/fujitsu.xlsx")
plot(fujitsu$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ fujitsu$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

fujitsu_r= fujitsu $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(fujitsu_r, seasonal=FALSE) # auto arima(0,0,0)
fit
## Series: fujitsu_r 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 estimated as 5.521:  log likelihood=-7499.23
## AIC=15000.46   AICc=15000.46   BIC=15006.56
fujitsu_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model='std')
fujitsu_garch <- ugarchfit(spec= fujitsu_spec, data= fujitsu_r)

3. forecast

fujitsu_f <- ugarchforecast(fujitsu_garch, n.ahead=40)
fujitsu_return_f <- fujitsu_f@forecast$seriesFor
fujitsu_volatility_f <- fujitsu_f@forecast$sigmaFor
plot(fujitsu_return_f, type='l') 

plot(fujitsu_volatility_f, type='l') 

Fuji Electric Co Ltd (6504)

1. import data

fuji <- read_excel("ESG/day-to-day-return/fuji.xlsx")
plot(fuji$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ fuji$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

fuji_r= fuji $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(fuji_r, seasonal=FALSE) # auto arima()
fit
## Series: fuji_r 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 estimated as 7.548:  log likelihood=-8015.29
## AIC=16032.58   AICc=16032.58   BIC=16038.68
fuji_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model='std')
fuji_garch <- ugarchfit(spec= fuji_spec, data= fuji_r)

3. forecast

fuji_f <- ugarchforecast(fuji_garch, n.ahead=40)
fuji_return_f <- fuji_f@forecast$seriesFor
fuji_volatility_f <- fuji_f@forecast$sigmaFor
plot(fuji_return_f, type='l') 

plot(fuji_volatility_f, type='l') 

Eizo Corp (6737)

1. import data

eizo <- read_excel("ESG/day-to-day-return/eizo.xlsx")
plot(eizo$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ eizo$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

eizo_r= eizo $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(eizo_r, seasonal=FALSE) # auto arima(1,0,2)
fit
## Series: eizo_r 
## ARIMA(1,0,2) with zero mean 
## 
## Coefficients:
##          ar1      ma1      ma2
##       0.7255  -0.7336  -0.0337
## s.e.  0.1478   0.1482   0.0199
## 
## sigma^2 estimated as 5.302:  log likelihood=-7431.12
## AIC=14870.25   AICc=14870.26   BIC=14894.65
eizo_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(1,2)), distribution.model='std')
eizo_garch <- ugarchfit(spec= eizo_spec, data= eizo_r)

3. forecast

eizo_f <- ugarchforecast(eizo_garch, n.ahead=40)
eizo_return_f <- eizo_f@forecast$seriesFor
eizo_volatility_f <- eizo_f@forecast$sigmaFor
plot(eizo_return_f, type='l') 

plot(eizo_volatility_f, type='l') 

Astellas Pharma Inc (4503)

1. import data

astellas <- read_excel("ESG/day-to-day-return/astellas.xlsx")
plot(astellas$DAY_TO_DAY_TOT_RETURN_GROSS_DVDS~ astellas$Date, yabl='DAY_TO_DAY_TOT_RETURN_GROSS_DVDS', type='l')

2. build GARCH model

astellas_r= astellas $DAY_TO_DAY_TOT_RETURN_GROSS_DVDS
fit = auto.arima(astellas_r, seasonal=FALSE) # auto arima(1,0,1)
fit
## Series: astellas_r 
## ARIMA(1,0,1) with non-zero mean 
## 
## Coefficients:
##          ar1      ma1    mean
##       0.5376  -0.6292  0.0425
## s.e.  0.1223   0.1132  0.0246
## 
## sigma^2 estimated as 3.109:  log likelihood=-6550.49
## AIC=13108.98   AICc=13108.99   BIC=13133.38
astellas_spec <- ugarchspec(variance.model=list(model='sGARCH', garchOrder=c(1,1)), mean.model=list(armaOrder=c(1,1)), distribution.model='std')
astellas_garch <- ugarchfit(spec= astellas_spec, data= astellas_r)

3. forecast

# forecast #
astellas_f <- ugarchforecast(astellas_garch, n.ahead=40)
astellas_return_f <- astellas_f@forecast$seriesFor
astellas_volatility_f <- astellas_f@forecast$sigmaFor
plot(astellas_return_f, type='l') 

plot(astellas_volatility_f, type='l')